<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN">

<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>易民后台</title>
    <link rel="shortcut icon" href="img/logo.png" type="image/x-icon" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
    <link href="css/bootstrap1-responsive.min.css" type="text/css" rel="stylesheet"/>
    <link href="css/bootstrap1.css" type="text/css" rel="stylesheet"/>

    <script src="js/bootstrap1.js"></script>
	 <script src="js/jquery-1.9.1.js"></script>
 </head>
	<style>
	   #g
	 {
	 position:relative;
	 display:none;

	 }
	 #hou{
	  width:100%;
	  height:100%;
	  position:absolute;
	  overflow:hidden;
	  z-index:90;
	
	  filter: alpha(Opacity=70); 
      -moz-opacity:0.7; 
      opacity:0.7; 
	 }
	 #login
	 {
	   width:400px;
	   height:200px;
	   background:white;
	   position:relative;
	   z-index:99;
	    border-radius:4px;
	    margin:auto;
	 }
	 #close
	 {
	   float:right;
	   width:20px;
	   height:20px;
	   top:0px;
	   text-align:center;
	   margin-right:10px;
	   margin-top:10px;
	 }
	 
   body{
	   background:gray;
	  font-size:15px;
	  background-image:url(img/bei.jpg);
	   -moz-background-size: 100%;  
    -o-background-size: 100%;  
    -webkit-background-size: 100%;  
    background-size: 100% ; 
  
	 }
	
	</style>
<body>
   <div id="g" >
	  <div id="hou">
	  </div>
	  <div id="login">
	    <div id="close" > <a href="javascript:void(0)"  onclick="closew()" style="color:gray" ></a></div>
	    <div style="width:390;height:30px;border-bottom:1px solid rgb(200,200,200); padding-top:10px; padding-left:10px; margin-bottom:15px;"><span style="color:red"><b>易民后台</b></span></div>
	    <form id="loginform" method="post" class="form-horizontal" enctype="multipart/form-data">
					<div class="control-group">
						<label class="control-label"><span style="color:red">*</span >地区:</label>
						
						<select id="sel1" style="width:80px" >
						  <option value="江苏" >江苏</option>
						</select>
						
						<select id="sel2" style="width:80px">
						</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					</div>
					<div class="control-group">
						<label class="control-label"><span style="color:red">*</span>账号:</label>
						<input id="name" name="name" type="text" ; />
						
					</div>
					<div class="control-group">
						<label class="control-label"><span style="color:red">*</span>密码:</label>
						<input id="password" name="password" type="password"/>
						
					</div>
					<div style="text-align:center;">
						<span class="pull-center">
							<input type="button" class="btn btn-danger" onclick="setInfo()" id="btn" value="登录" />
						</span>
						<input id="place" name="place" type="hidden">
					</div>
				</form>
	  </div>
	</div>
</body>
<script>

$(function(){

  
	   var ua = navigator.userAgent; 
        var s = "MSIE"; 
        var i = ua.indexOf(s);          
        if (i >= 0) { 
            choose="../../"; 
        } 
        else {
           choose="http://name.emcncn.com:8080/"; 
        } 
	 
	   var newdate=format(new Date());
	   var url2=choose+"mobile/api/v1/get/openarea?place=nj&date="+newdate;
	   url2=encodeURI(url2);
	   url2=encodeURI(url2);
	  
	$.ajax({
				url:url2,
				type:"get",
				dataType: "JSON",
				async:false,
				timeout: 3000,
				headers: {Origin:"*"},
				success: function(result) {
				$("#second_1_4 div").remove();
				
				    for(var i=0;i<result.length;i++)
				    {
				     
					   $("#sel2").append("<option value=\'"+result[i].city+"\'>"+result[i].city+"</option>");
					}
					 },
				error: function(XMLRequest, textInfo) {
					if (textInfo!= null) {
					}
				}
			}); 
			
	     houtai();
	  
	

})

	
	   function houtai()
	   {
	     $("#g").css("display","block");
	       var bh=$(window).height();
	     var gw=$(window).width();
	     var hc=bh-300;
	     var th=hc/2+50;
	     $("#login").css("margin-top",th+"px");
	   }
	   
	    function closew()
	   {
	   // $("#g").css("display","none");
	   }
	   
	   function setInfo(){  
			//var place = document.getElementById("sel2").options[document.getElementById("sel2").selectedIndex].value;
			var place=$.trim($("#sel2").val());
			var name = $.trim($("#name").val());
			var password =$.trim($("#password").val());
			 if(name==""||password=="")
			 {
			    alert("用户名或密码格式不正确");
			    return false;
			 }
			var form = document.forms['loginform'];
			form.action ='http://name.emcncn.com/mobile/browser/login_forward?name='+name+'&password='+password+'&place='+place; 
			//form.target = "_blank";
			form.submit();
			$("#g").css("display","none");
		}
		
		
		function add0(m){return m<10?'0'+m:m }
		function format(shijianchuo)
     {
var time = new Date(shijianchuo);
var y = time.getFullYear();
var m = time.getMonth()+1;
var d = time.getDate()+1;
var h = time.getHours()+1;
var mm = time.getMinutes()+1;
var s = time.getSeconds()+1;
return y+''+add0(m)+''+add0(d)+''+add0(h)+''+add0(mm)+''+add0(s);
     }   

</script>
</html>	

